/**
*      author: Y_Yao
*      created: 2025-01-23 12:46:19
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 7;
int n,m;
int p[N];
int ans = 0;
int ret = 0;

bool check(__int128 x)
{
    __int128 re = m;
    ret = 0;
    for(int i = 1;i <= n;i++)
    {
        __int128 k = (x / p[i] + 1) / 2;
        ret += k;
        re -= k * k * p[i];
        if(re < 0)
        {
            return false;
        }
    }

    for(int i = 1;i <= n;i++)
    {
        __int128 k = (x / p[i] + 1) / 2;
        if((k + k + 1) * p[i] == x + 1 && re >= (k + k + 1) * p[i])
        {
            ret++;
            re -= (k + k + 1) * p[i];
        }
    }
    return true;
}

void solve()
{
    cin >> n >> m;
    for(int i = 1;i <= n;i++)
    {
        cin >> p[i];
    }

    int l = 0,r = 1e18;
    while(l < r)
    {
        int mid =  l + r + 1 >> 1;
        if(check(mid))
        {
            ans = ret;
            l = mid;
        }
        else
        {
            r = mid - 1;
        }
    }

    cout << ans << endl;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}